# Maintainer(Arch): Tim Savannah <kata198@gmail.com>
# Maintainer: Sagar Acharya <sagar@hyperbola.info>

pkgname=('python-advancedhtmlparser' 'python-advancedhtmlparser-tools')
pkgver=9.0.1
pkgrel=1
pkgdesc="Fast Indexed python HTML parser which builds a DOM node tree, providing common getElementsBy* functions for scraping, testing, modification, and formatting"
arch=('any')
license=('LGPL-3')
url="http://github.com/kata198/AdvancedHTMLParser"
makedepends=('python-setuptools' 'python')
depends=('python-setuptools' 'python')
optdepends=('python-queryablelist: Support for advanced "filter" functions')
source=("https://github.com/kata198/AdvancedHTMLParser/archive/${pkgver}.tar.gz")
sha512sums=("4e19103c25224b5b220053ec0ccbc2ddaf927ccbbf2f9ccd5e3f4b403013c17db01ee9e0d7117a6ce7c7ccec157aa877c7cdba6763f649bab50371beab89bf73")

build() {
  cd "$srcdir"/AdvancedHTMLParser-$pkgver
  python setup.py build
}

package_python-advancedhtmlparser() {
  cd AdvancedHTMLParser-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/python-advancedhtmlparser/LICENSE

  # Remove tools from lib package
  rm -Rf "$pkgdir/usr/bin"
}

package_python-advancedhtmlparser-tools() {
  depends=('python-advancedhtmlparser')
  conflicts=('tauthon-advancedhtmlparser-tools')
  cd AdvancedHTMLParser-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/python-advancedhtmlparser-tools/LICENSE

  # Remove lib from tools package
  rm -Rf "${pkgdir}/usr/lib"
}
